const { form } = layui
form.verify({
  password: [/^[\S]{6,10}$/, '密码是6到10位, 不能有空格'],
  diff: function (value) {
    return $('.oldPwd').val() == value && '新密码和旧密码不能一样'
  },
  same: function (value) {
    return $('.newPwd').val() !== value && '两次密码不相同'
  },
})
$('.layui-form').on('submit', async function (e) {
  e.preventDefault()
  const obj = {
    oldPwd: $('input[name=oldPwd]').val(),
    newPwd: $('input[name=newPwd]').val(),
  }
  const res = await postResetPwd(obj)
  console.log(res)
  window.parent.location.href = '/login.html'
})
